<?php

class AuthPlugin extends Zend_Controller_Plugin_Abstract
{
	public function preDispatch(Zend_Controller_Request_Abstract $request)
	{
		$controller = $request->getControllerName();
		$action		= $request->getActionName();
		$module		= $request->getModuleName();
		
		$auth = Zend_Auth::getInstance();
		
		if (!$auth->hasIdentity()) 
		{ 
			$controller	= 'auth';
			$action		= 'login';
		}
		
		$request->setControllerName($controller);
		$request->setActionName($action);
	}
}